const { classesModel } = require('../models/classesModel')

module.exports.createClasses = async (req, res) => {
    const data = req.body;
    // console.log('接受前端发送的班级数据', data);
    const result = await classesModel.create(data);
    res.send({
        code:1,
        message: '班级数据新增成功',
        result
    })

}

module.exports.getClasses = async (req, res) => {
    const result = await classesModel.find().populate('subjectsId');
    res.send({
        code:1,
        message:'班级数据获取成功',
        result
    })
}
// 根据专业_id 获取班级信息
module.exports.getClassesBySubjectsId = async (req, res) => {
    const data = req.query;
    const result = await classesModel.find(data);
    res.send({
        code:1,
        message:'根据专业获取班级成功',
        result
    })
}